package com.futvan.z.erp.customer;
import java.util.HashMap;
import com.futvan.z.framework.core.SuperAction;
import com.futvan.z.framework.common.bean.Code;
import com.futvan.z.framework.common.bean.Result;
import com.futvan.z.framework.common.service.CommonService;
import com.futvan.z.framework.core.z;
import com.futvan.z.framework.util.StringUtil;
import org.springframework.stereotype.Controller;
import org.springframework.web.servlet.ModelAndView;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.ResponseBody;
import org.springframework.beans.factory.annotation.Autowired;
@Controller
public class Crm_customerStart_temp_renewButtonAction extends SuperAction{

	@Autowired
	private CommonService commonService;

	@RequestMapping(value="/start_temp_renew")
	public @ResponseBody Result start_temp_renew(@RequestParam HashMap<String,String> bean) throws Exception {
		Result result = new Result();
		String zids = bean.get("zids");
		if(z.isNotNull(zids)){
			String in = StringUtil.ListToSqlInArray(zids);
			String sql = "UPDATE crm_customer SET is_temp_renew = '1', temp_renew_time = NOW() WHERE zid IN ("+in+");";
			int n = sqlSession.update("update",sql);
			result.setSuccess(n);
		}else{
			result.setError("start_temp_renew error|zids is null");
		}
		return result;
	}
}
